Skip to content

feat(plugin-copy-code): add inlineSelector option #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Mar 28, 2025
Merged

Conversation

Mister-Hope
Copy link
Member

No description provided.

@Mister-Hope Mister-Hope requested review from Copilot and pengzhanbo and removed request for Copilot March 28, 2025 13:43
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an inlineSelector option to the copy code plugin so that inline code content can be copied with a double click. It also refactors the ignoreSelector option to allow for a single selector string and updates both the plugin implementation and documentation accordingly.

  • Updated options definitions (ignoreSelector and inline)
  • Modified plugin configuration to handle inline copying and selector type changes
  • Revised composable usage and documentation in both English and Chinese

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
plugins/features/plugin-copy-code/src/node/options.ts Updated option types and added the inline option for specifying selectors or enabling inline copying
plugins/features/plugin-copy-code/src/node/copyCodePlugin.ts Adjusted configuration for selectors including inline code and modified the inline selector logic
plugins/features/plugin-copy-code/src/client/composables/useCopyCode.ts Changed the selector type and added inlineSelector handling via a double-click event listener
docs/zh/plugins/features/copy-code.md Updated documentation to include details about the inlineSelector option (Chinese)
docs/plugins/features/copy-code.md Updated documentation to include details about the inlineSelector option (English)
Comments suppressed due to low confidence (1)

plugins/features/plugin-copy-code/src/node/copyCodePlugin.ts:34

  • [nitpick] Consider refactoring the nested ternary for CC_INLINE_SELECTOR for better readability. For instance, using an explicit check for a boolean value (e.g., options.inline === true) could improve clarity.
          : options.inline
              ? '[vp-content] :not(pre) > code'
              : ''

@Mister-Hope Mister-Hope linked an issue Mar 28, 2025 that may be closed by this pull request
@coveralls
Copy link

coveralls commented Mar 28, 2025

Pull Request Test Coverage Report for Build 14134103214

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 59.517%

Totals Coverage Status
Change from base Build 14133381781: 0.0%
Covered Lines: 1358
Relevant Lines: 2059

💛 - Coveralls

@Mister-Hope Mister-Hope merged commit e9117f8 into main Mar 28, 2025
30 checks passed
@Mister-Hope Mister-Hope deleted the inline-copy branch March 28, 2025 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] Add support of code tags
2 participants